home *** CD-ROM | disk | FTP | other *** search
- NETWORK.SYS is a small DOS device driver that allows a program to send
- datagrams over a Netbios network (Lantastic) as if the network were a
- character device.
-
- The small C example illustrates how the driver is called from a
- C program. If Netbios is not present or for some other reason is
- not working, the fopen() will fail. If there is no network message
- available, fread() returns a 0 length result.
-
- Following the C example is a small Quick Basic program which performs
- the same function.
-
- Installing NETWORK.SYS uses the following syntax:
-
- DEVICE=<pathname>NETWORK.SYS <NODE_NAME>
-
- where NODE_NAME can be as follows:
-
- DEVICE=<pathname>NETWORK.SYS HOST or
- DEVICE=<pathname>NETWORK.SYS DEV1
-
- The name of the network node is the 4 characters following the device
- statement. There should be only one space between SYS and the node name.
-
- The format of the message sent is <NODE_NAME><Message>
-
- The device driver uses the Netbios SEND_DATAGRAM function so any message
- sent looks like a new message for the sender as well so the driver
- discards the message if the node name matches the sender.
-
- #include <stdio.h>
- void main(void);
- void main()
- {
- FILE *device;
- char InBuff[128];
- char Message[128];
- short BuffIndex;
-
- device = fopen("NETBIOS1","r+");
- if (device == NULL)
- {
- printf("Error opening device\n");
- }
- else
- {
- //
- // read to see if there is a message available
- //
- BuffIndex = fread(InBuff,sizeof(char),128,device);
- InBuff[BuffIndex] = '\0';
- printf("Chars Read = %d [%s]\n",BuffIndex,InBuff);
- //
- // ask for message to send
- //
- printf("\nEnter Message To Send ..... ");
- gets(Message);
- if (strlen(Message) != 0)
- {
- fprintf(device,"%s\r",Message);
- }
- fclose(device);
- }
- }
-
- rem
- rem test for a network message
- rem
- OPEN "NETBIOS1" FOR INPUT AS #1
- IF EOF(1) GOTO 1002
- INPUT #1, a$
- PRINT a$
- GOTO 1003
- 1002 PRINT "No Network Message"
- 1003 CLOSE
- rem
- rem send a message
- rem
- OPEN "NETBIOS1" FOR OUTPUT AS #1
- PRINT "Enter Message to Send...";
- INPUT a$
- IF LEN(a$) = 0 THEN GOTO 1004
- PRINT #1, a$
- 1004 CLOSE
-
- The ASM source code (NETWORK.ASM) is included in the zip file as well as
- the executable file (NETWORK.SYS).
-
- The program is assembled using the following commands:
-
- masm network;
- link network;
- exe2com network network.sys
- Note: exe2com can be found on CompuServe
-
- A small diagnostic tool is also included - SHOWDDH, which is a modification
- of a similar program in "Writing Device Drivers in C" by Adams & Tondo.
- It will verify that NETWORK.SYS is loaded and show where it is in memory
- so that you can look at the buffers if desired. Included are SHOWDDH.C
- and SHOWDDH.EXE.
-
- I would prefer not to provide nationwide tech support but I will try to
- answer EMAIL questions to:
- Steve Bean, MicroPlot Systems Co.
- CompuServe: 70575,406
- Internet: 70575.406@CompuServe.COM